feat(config): one-time config.toml migration to state.toml + keychain#248
Open
LorrisSaintGenez wants to merge 8 commits into
Open
feat(config): one-time config.toml migration to state.toml + keychain#248LorrisSaintGenez wants to merge 8 commits into
LorrisSaintGenez wants to merge 8 commits into
Conversation
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 51 |
| Duplication | 16 |
TIP This summary will be updated as you push new changes.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Two startup-path regressions found while testing edge cases: - An undecodable profile (root-level scalar, unconvertible field type) hit ConfiguredProfiles' log.Fatalf and bricked every command, --help included, forever (state.toml never written). The migration now decodes profiles itself and skips undecodable entries with a log. - An unparseable config.toml was silently read as zero profiles, so an empty state.toml marked the migration as done forever. Migrate now aborts when config.toml cannot be parsed and retries on the next run. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The remaining non-secret profile data moves with the migration so it survives the eventual config.toml removal. GetSearchHosts and GetCrawlerUserID gain a new-model branch: the resolved application's state.toml entry answers first, an empty value falls through to the legacy config.toml lookup while both models coexist. admin_api_key stays excluded as decided on the ticket. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Legacy migrated keys have no UUID, so without omitempty every migrated entry serialized a noisy api_key_uuid = "". The field is only set by new-model writes (app create/select); omitting the empty value matches search_hosts/crawler_user_id and reads back identically. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The select picker decorated choices from config.toml profiles only, so apps configured under the new model showed as unconfigured. It now marks an app "(configured)" when state.toml holds an entry for it, falling back to legacy config.toml profiles while config.toml is still supported. Adds Config.ApplicationInState for the state-only lookup. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
… auth Two follow-ups from auditing the command tree against state.toml: - application list marked apps configured from config.toml profiles only, so new-model apps showed as "(not configured)". It now uses the same state-first/config-fallback check as the select picker, centralized in apputil.ApplicationConfigured. - describe walks the command tree and needs no credentials, but lacked skipAuthCheck so it failed on a machine with nothing configured. It now skips the auth check. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
48629f8 to
383dd0d
Compare
When state.toml resolves a current application but its key isn't in this machine's keychain (e.g. state.toml synced across machines without it), GetAPIKey/GetCrawlerAPIKey returned the generic "not configured yet". The error now names the application and points to the fix (`application select` / `auth crawler`, or the matching env var). Re-authenticating rewrites the keychain entry, so it restores a working state. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
One-time, first-run migration of legacy
config.tomlprofiles tostate.toml+ OS keychainconfig.tomlexists butstate.tomldoesn't (its absence = "not migrated"). Runs before credential resolution; a failure never blocks the command and retries next run.api_key/crawler_api_key→ keychain;alias,search_hosts,crawler_user_id→state.toml;current_application_id= thedefaultprofile.admin_api_keyexcluded.state.tomllast (temp + rename). Empty config still writes an emptystate.tomlso the trigger stops firing.application_id/api_keyskipped; sameapplication_id→ default wins; undecodable profiles or unparseable config abort/skip instead of crashing.config.tomlis never modified.Test
config.tomlprofiles file (you should if you ever used the CLI with a profile before)GROUT-363